package com.happystudy.configuration;

import com.happystudy.tools.BaseUrlLinkBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.thymeleaf.TemplateEngine;

/**
 * @author LYJ
 */
@Configuration
@PropertySource({"classpath:application.properties"})
public class BaseUrlConfig {
    
    @Value("${pro.web.baseUrl}")
    private String baseUrl;

    @Bean
    public BaseUrlLinkBuilder baseUrlLinkBuilder(TemplateEngine templateEngine){
        System.out.println("我启动了");
        BaseUrlLinkBuilder baseUrlLinkBuilder = new BaseUrlLinkBuilder();
        baseUrlLinkBuilder.setBaseUrl(baseUrl);
        templateEngine.setLinkBuilder(baseUrlLinkBuilder);
        return baseUrlLinkBuilder;
    }

}
